package com.atguigu.system.controller;


import com.atguigu.common.result.Result;
import com.atguigu.model.system.SysCalendar;
import com.atguigu.system.annotation.Log;
import com.atguigu.system.enums.BusinessType;
import com.atguigu.system.service.SysCalendarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 日历表 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2024-06-19
 */
@Api(tags = "日历管理")
@RestController
@RequestMapping("/admin/system/sysCalendar")
public class SysCalendarController {

    @Resource
    private SysCalendarService service;

    @ApiOperation("按月份给日期灌入数据")
    @Log(title = "按月份给日期灌入数据",businessType = BusinessType.INSERT)
    @PostMapping("/batchDateByMonth")
    public Result batchDateByMonth(@RequestBody Map<String,Integer> param) {
        service.batchDateByMonth(param);
        return Result.ok();
    }

    @ApiOperation("查询某月的日历数据")
    @PostMapping("findList")
    public Result findList(@RequestBody Map<String,Integer> param) {
        List<SysCalendar> list = service.findList(param);
        return Result.ok(list);
    }
}

